package com.example.anr;

import android.os.MessageQueue;

import com.zy.zlog.ZLog;

public class MyIdleHandler implements MessageQueue.IdleHandler {
    public MessageQueue.IdleHandler idleHandler;
    private static int ID = 0;
    private int id;

    public MyIdleHandler(MessageQueue.IdleHandler o) {
        idleHandler = o;
        id = ID++;
    }

    @Override
    public boolean queueIdle() {
        long startTime = System.currentTimeMillis();
        boolean i = idleHandler.queueIdle();
        long endTime = System.currentTimeMillis();
        AnrLog.d("MyIdleHandler", id + " cost:" + (endTime - startTime) + " " + idleHandler);
        return i;
    }
}
